import request from '@/utils/request';

/**
 * 查询接口列表
 * @param query
 * @returns {*}
 */

export const listOpenApi = (query) => {
  return request({
    url: '/system/openapi/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询接口详细
 * @param id
 */
export const getOpenApi = (id) => {
  return request({
    url: '/system/openapi/' + id,
    method: 'get'
  });
};

/**
 * 新增接口
 * @param data
 */
export const addOpenApi = (data) => {
  return request({
    url: '/system/openapi',
    method: 'post',
    data: data
  });
};

/**
 * 修改接口
 * @param data
 */
export const updateOpenApi = (data) => {
  return request({
    url: '/system/openapi',
    method: 'put',
    data: data
  });
};

/**
 * 删除接口
 * @param id
 */
export const delOpenApi = (id) => {
  return request({
    url: '/system/openapi/' + id,
    method: 'delete'
  });
};

/**
 * 接口状态修改
 * @param id ID
 * @param status 状态
 */
export function changeStatus(id, status) {
  const data = {
    id,
    status
  };
  return request({
    url: '/system/openapi/changeStatus',
    method: 'put',
    data: data
  });
}
